package cannot.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cannot.mapper.TvMapper;
import cannot.pojo.Tv;
import cannot.service.TvService;

@Service
public class TvServiceImpl implements TvService {
	@Autowired
	TvMapper tvMapper;
	
	public int insert(Tv record) {
		int id = tvMapper.insert(record);
		return id;
	}

	public Tv selectById(Integer id) {
		return tvMapper.selectByPrimaryKey(id);
	}

	public List<Tv> listTvs() {
		return tvMapper.selectByExample(null);
	}

	public List<Tv> listTvImagesIndex(Integer id) {
		return tvMapper.listTvImagesIndex(id);
	}

	public List<Tv> listTvUrlIndex(Integer id) {
		return tvMapper.listTvUrlIndex(id);
	}

	public List<Tv> listTvOtherType(Integer id) {
		return tvMapper.listTvOtherType(id);
	}

	@Override
	public void updateTv(Tv tv) {
		tvMapper.updateByPrimaryKey(tv);
	}

	@Override
	public List<Tv> selectTvPraiseByUid(Long uid) {
		return tvMapper.selectTvPraiseByUid(uid);
	}

	@Override
	public List<Tv> selectTvHistoryByUid(Long uid) {
		return tvMapper.slelectTvHistoryByUid(uid);
	}

	@Override
	public List<Tv> slelectTvLikeById(Integer tvId) {
		return tvMapper.slelectTvLikeById(tvId);
	}

	@Override
	public List<Tv> selectTvByMainTypeId(Integer mainTypeId, String sort) {
		return tvMapper.selectTvByMainTypeId(mainTypeId, sort);
	}

	@Override
	public List<Tv> selectTvByOtherTypeId(Integer otherId, String sort) {
		return tvMapper.selectTvByOtherTypeId(otherId, sort);
	}

	@Override
	public void deleteTvById(Integer id) {
		tvMapper.deleteByPrimaryKey(id);
	}

}
